/*
 * channel_laucher_broker.cpp
 *
 */

#include "../common/Argv.h"
#include "../IPC/MessageQueue.h"
#include "../channel_common/ChannelCommon.h"
#include "../channel_common/BrokerQueue.h"
#include "../IPC/Sequence.h"
#include "../IPC/ProcessAux.h"
#include "../channel_common/routing_tables/RoutingService.h"
#include "../channel_common/agent_address_service/AgentAddressService.h"

int main(int argc, char**argv)
{
	//Toma argumentos (main)
	Argv args(argv);
	std::string brokerName;

	if (args.getArgc() != 2)
	{
		std::cout <<"Broker launcher Error: Cantidad de parametros invalida."<<std::endl;
		exit(1);
	}

	brokerName = args.getArg(1);

	channel::BrokerQueue::create(brokerName);

	Argv serverArgs;
	serverArgs.pushArg(brokerName);

	ProcessAux::launchProcess2("./out/servidor_out_broker",1,serverArgs);
	ProcessAux::launchProcess2("./out/servidor_in_broker",1,serverArgs);

	return 0;
}
